package com.ygq.config;

import com.ygq.interceptor.studentInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebConfig implements WebMvcConfigurer {

    //拦截器对象
    @Autowired
    private studentInterceptor studentInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //注册自定义拦截器对象----学生
        registry.addInterceptor(studentInterceptor)
                .addPathPatterns("/com/ygq/**")//拦截所有学生端请求
                .excludePathPatterns("/com/ygq/login");//不拦截学生登录请求
    }
}
